<html>
<head><meta charset="utf-8"><title>libc: why does the signedness of c_char matter? · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/libc.3A.20why.20does.20the.20signedness.20of.20c_char.20matter.3F.html">libc: why does the signedness of c_char matter?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="184066548"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/libc%3A%20why%20does%20the%20signedness%20of%20c_char%20matter%3F/near/184066548" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/libc.3A.20why.20does.20the.20signedness.20of.20c_char.20matter.3F.html#184066548">(Dec 22 2019 at 19:36)</a>:</h4>
<p>When checking bugs for <code>libc</code> I found this issue: <a href="https://github.com/rust-lang/libc/issues/1284" target="_blank" title="https://github.com/rust-lang/libc/issues/1284">https://github.com/rust-lang/libc/issues/1284</a><br>
Where <span class="user-mention" data-user-id="132920">@gnzlbg</span> states that you should have the correct signedness for <code>c_char</code> (<code>i8</code> vs <code>u8</code>). Don't <code>c_char</code> values only have meaning in the 0 to 127 range anyway? So why does the sign matter?</p>
<p>(people besides gnzlbg can also answer, i'm just pinging them since they made the statement; Also I didn't want to clog up the issue tracker with what is probably just a beginner's question)</p>



<a name="184083879"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/libc%3A%20why%20does%20the%20signedness%20of%20c_char%20matter%3F/near/184083879" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/libc.3A.20why.20does.20the.20signedness.20of.20c_char.20matter.3F.html#184083879">(Dec 23 2019 at 05:13)</a>:</h4>
<p>value outside 0..=127 are meaningful too, it's only that they're subject to locale and mbcs  mechanisms, and their meaning changes according to the current runtime setting.</p>



<a name="184092525"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/libc%3A%20why%20does%20the%20signedness%20of%20c_char%20matter%3F/near/184092525" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/libc.3A.20why.20does.20the.20signedness.20of.20c_char.20matter.3F.html#184092525">(Dec 23 2019 at 09:22)</a>:</h4>
<p>I'm pretty much offline after the holidays, but I've tried to write a more expanded answer on the github issue</p>



<a name="184092533"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/libc%3A%20why%20does%20the%20signedness%20of%20c_char%20matter%3F/near/184092533" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/libc.3A.20why.20does.20the.20signedness.20of.20c_char.20matter.3F.html#184092533">(Dec 23 2019 at 09:22)</a>:</h4>
<p><span class="user-mention" data-user-id="224471">@Lokathor</span> it would be simpler to just discuss that there</p>



<a name="184092540"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/libc%3A%20why%20does%20the%20signedness%20of%20c_char%20matter%3F/near/184092540" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/libc.3A.20why.20does.20the.20signedness.20of.20c_char.20matter.3F.html#184092540">(Dec 23 2019 at 09:22)</a>:</h4>
<p>but it might take me a couple of days to answer</p>



<a name="184109078"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/libc%3A%20why%20does%20the%20signedness%20of%20c_char%20matter%3F/near/184109078" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/libc.3A.20why.20does.20the.20signedness.20of.20c_char.20matter.3F.html#184109078">(Dec 23 2019 at 14:48)</a>:</h4>
<p>Well you could ping me in an answer there if you like. Or here. Either way, but people often seem to get grumpy about github issues filling up with "offtopic" questions.</p>
<p>But yeah, take your time, very busy part of the year for most people.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>